import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
import 'package:images_picker/images_picker.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 店铺招租
///
class StoreRent extends StatefulWidget {
  const StoreRent({Key? key}) : super(key: key);

  @override
  State<StoreRent> createState() => _StoreRentState();
}

class _StoreRentState extends State<StoreRent> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: ToolsUtils.getDefaultBrnAppBar('店铺招租'),
      body: SingleChildScrollView(
        padding: const EdgeInsets.symmetric(vertical: Sizes.default10, horizontal: Sizes.default15),
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: ListBody(
                children: [
                  Stack(
                    children: [
                      Container(
                        alignment: Alignment.center,
                        child: GFImageOverlay(
                          height: 200,
                          width: 345,
                          image: ToolsUtils.assetImage('store_rent.png'),
                          borderRadius: BorderRadius.circular(Sizes.default10),
                        ),
                      ),
                      Positioned(
                          width: 30,
                          height: 30,
                          right: Sizes.default15,
                          bottom: Sizes.default15,
                          child: IconButton(
                            onPressed: () {
                              ToolsUtils.openCupertinoModalPopup(context, setMediaImg, setMediaImg);
                            },
                            icon: const Icon(AntdIcons.editFill,
                                color: Colors.white, size: Sizes.default20),
                          ))
                    ],
                  ),
                  Container(
                    margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                    alignment: Alignment.center,
                    child: Text('外卖招租店',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333)),
                  ),
                  Center(
                    child: Text('(推荐尺寸750x240像素）',
                        style: StylesUtils.customTextStyle(
                            fontSize: Sizes.default13, color: ColorsUtils.color999)),
                  )
                ],
              ),
            ),
            Container(
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: ListBody(
                children: [
                  Stack(
                    children: [
                      Container(
                        alignment: Alignment.center,
                        child: GFImageOverlay(
                          height: 200,
                          width: 345,
                          image: ToolsUtils.assetImage('store_rent2.png'),
                          borderRadius: BorderRadius.circular(Sizes.default10),
                        ),
                      ),
                      Positioned(
                          width: 30,
                          height: 30,
                          right: Sizes.default15,
                          bottom: Sizes.default15,
                          child: IconButton(
                            onPressed: () {
                              ToolsUtils.openCupertinoModalPopup(context, setMediaImg, setMediaImg);
                            },
                            icon: const Icon(AntdIcons.editFill,
                                color: Colors.white, size: Sizes.default20),
                          ))
                    ],
                  ),
                  Container(
                    margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                    alignment: Alignment.center,
                    child: Text('团购店招租',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333)),
                  ),
                  Center(
                    child: Text('(推荐尺寸750x240像素）',
                        style: StylesUtils.customTextStyle(
                            fontSize: Sizes.default13, color: ColorsUtils.color999)),
                  )
                ],
              ),
            ),
            SizedBox(
              height: Sizes.default40,
              child: FractionallySizedBox(
                widthFactor: 1,
                child: GFButton(
                    onPressed: () {},
                    text: '确定',
                    textStyle: StylesUtils.customTextStyle(fontSize: Sizes.default16),
                    shape: GFButtonShape.pills,
                    type: GFButtonType.solid,
                    size: GFSize.LARGE,
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorFf6)),
              ),
            )
          ],
        ),
      ),
    );
  }

  void setMediaImg(List<Media> res) {
    setState(() {});
  }
}
